<?php
/**
 * Created by PhpStorm.
 * User: geyouwen
 * Date: 16/9/7
 * Time: 下午1:58
 */

namespace Home\Model;


use Think\Model;

class MemberModel extends Model
{

    protected $_validate = array(
        array('mobile','','手机号码已经被注册！',0,'unique',1), // 在新增的时候验证name字段是否唯一
    );
    //检测是否唯一
    public function uniqueCheck($field, $check_value, $fields='id, username, mobile, email')
    {
        $where = array(
            $field => $check_value
        );
        return $this->where($where)->field($fields)->find();
    }


}